package net.lab1024.sa.admin.module.business.bjd.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.bjd.domain.form.DollQueryForm;
import net.lab1024.sa.admin.module.business.bjd.domain.form.OrderImportForm;
import net.lab1024.sa.admin.module.business.bjd.domain.form.OrderQueryForm;
import net.lab1024.sa.admin.module.business.bjd.domain.form.OrderUpdateForm;
import net.lab1024.sa.admin.module.business.bjd.domain.vo.DollVO;
import net.lab1024.sa.admin.module.business.bjd.domain.vo.OrderVo;
import net.lab1024.sa.admin.module.business.bjd.service.OrderService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;

/**
 *
 * @author guolong.zhang
 * @date 2025/02/09 09:52
 **/
@RestController
@Tag(name = "订单管理")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Operation(summary = "分页查询")
    @PostMapping("/bjd/order/queryPage")
    public ResponseDTO<PageResult<OrderVo>> queryPage(@RequestBody @Valid OrderQueryForm queryForm) {
        return ResponseDTO.ok(orderService.queryPage(queryForm));
    }

    @Operation(summary = "订单导入")
    @PostMapping("/bjd/order/import")
    public ResponseDTO<Void> importOrder(@RequestParam MultipartFile file) {
        orderService.importOrder(file);
        return ResponseDTO.ok();
    }

    @Operation(summary = "修改订单")
    @PostMapping("/bjd/order/update")
    public ResponseDTO<Void> updateOrder(@RequestBody @Valid OrderUpdateForm req) {
        orderService.updateOrder(req);
        return ResponseDTO.ok();
    }


}
